package bio;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

public class BioServer {
    public static void main(String[] args) {
        try (ServerSocket server = new ServerSocket(8888)) {
            Socket socket = server.accept();
            Scanner scanner = new Scanner(socket.getInputStream());
            while (true) {
                String line = scanner.nextLine();
                System.out.println(line);
                String response = "server say hello to " + line + "\n";
                socket.getOutputStream().write(response.getBytes());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
